import React, { Component } from 'react';
import {
    Platform,
    StyleSheet,
    Text,
    Image,
    View,
    TextInput,
    Alert,
    FlatList,
    TouchableOpacity,
    ViewPagerAndroid,
} from 'react-native';
import {NavigationActions} from 'react-navigation';

import ChartListSearch from '../ui/chartListSearch';
import ChartListItem from '../ui/chartListItem'
export default class ChatListScene extends Component {
    constructor(props){
        super(props)
        global.navi = this.props.navigation.navigate
    }
    refresh(){

    }
    openChatScene(){
        this.props.navigation.navigate('chatScene')
    }
    search(){
        this.props.navigation.navigate('searchScene')
    }

    render() {
        return (
            <View style={styles.viewPager} >
                <View style={styles.pageStyle}>
                    <FlatList
                        style={styles.flststyle}
                        ListHeaderComponent={({ item }) => <ChartListSearch search={()=>{this.props.navigation.navigate('searchScene',{
                        searchType:'searchUserFriend',
                    })}}/>}
                        onRefresh={this.refresh}
                        refreshing={false}
                        data={[{ key: 'a',friendUid:'200093' }, { key: 'b',friendUid:'200100' }]}
                        renderItem={({ item }) => <ChartListItem chatScene={()=>{
                            this.props.navigation.navigate('chatScene',{
                                friendUid: item.friendUid,
                                friendPic: 'https://placeimg.com/140/140/any',
                                friendName: '那网科技',
                            })
                        }}/>}
                    />
                </View>

            </View>
        )

    }

}

const styles = {
    viewPager: {
        flex: 1,
        backgroundColor:"#fff",
        // height:100,
    },
    pageStyle: {
        // alignItems: 'center',
        // padding: 20,
        
    },
    flststyle:{}
}